﻿using System.ComponentModel;
using Util;

namespace IterationLife.ContentResources.Enums
{
    /// <summary>
    /// 内容资源封面类型
    /// </summary>
    public enum ContentResourceBannerType
    {
        /// <summary>
        /// 单图
        /// </summary>
        [Description("单图")]
        Single = 1,
        /// <summary>
        /// 三图
        /// </summary>
        [Description("三图")]
        Three = 2,
        /// <summary>
        /// 自动
        /// </summary>
        [Description("自动")]
        Automatic= 3
    }

    /// <summary>
    /// 内容资源封面类型枚举扩展
    /// </summary>
    public static class ContentResourceBannerTypeExtensions
    {
        /// <summary>
        /// 获取描述
        /// </summary>
        public static string Description(this ContentResourceBannerType? type)
        {
            return type == null ? string.Empty : type.Value.Description();
        }

        /// <summary>
        /// 获取值
        /// </summary>
        public static int? Value(this ContentResourceBannerType? type)
        {
            return type?.Value();
        }
    }
}
